package com.hmdp.config;

import com.hmdp.interceptor.FirstInterceptor;
import com.hmdp.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class SpringMvcConfig extends WebMvcConfigurationSupport {
   @Autowired
   private LoginInterceptor loginInterceptor;

   @Autowired
   private FirstInterceptor firstInterceptor;


    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(firstInterceptor).addPathPatterns(
                "/**"
        );



        registry.addInterceptor(loginInterceptor).excludePathPatterns(
                "/user/login",
                "/user/code",
                "/blog/hot",
                "/upload/**",
                "/shop-type/**",
                "/voucher/**",
                "/shop/**"
        );
    }
}
